package com.conn;
import java.io.*;

public class Communicate {
    PipedOutputStream po;
    PipedInputStream pi;
    public Communicate() throws IOException {
        po = new PipedOutputStream();
        pi = new PipedInputStream(po);
        //po.connect(pi);
    }

    public void send(int val) throws IOException {
        po.write(val);
    }

    public int recv() throws IOException {
        return pi.read();
    }

    public int AvailableBytes() throws IOException {
        return pi.available();
    }

    public void destroy() throws IOException {
        pi.close();
        po.close();
    }
}
